from typing import Optional, List


class Solution:
    def lengthOfLongestSubstring(self, s: str) -> int:
        if len(s) < 1:
            return 0
        if len(s) == 1:
            return 1
        slow, fast = 0, 1
        maxlen = 0
        result = [s[slow]]
        while slow < fast < len(s):
            if s[fast] not in result:
                result.append(s[fast])
                fast += 1
            else:
                maxlen = max(maxlen, fast - slow)
                slow += 1
                fast = slow + 1
                result = [s[slow]]
        maxlen = max(maxlen, fast - slow)
        return maxlen


so = Solution()
s = "au"
print(so.lengthOfLongestSubstring(s))
